home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / APP / E-L / IQ_Test.cpt / IQ Test ƒ / IQ Test Sorce Code ƒ / IQ Test.c < prev    next >
C/C++ Source or Header  |  1993-02-17  |  1KB  |  69 lines

  1. #include "IQ Test.h"
  2.  
  3. static void            InitToolBox( void );
  4.  
  5. main()
  6.     {
  7.     short            i,
  8.                     status = noErr;
  9.     DialogPtr        theDialog;
  10.     EventRecord        theEvent;
  11.  
  12.     /*
  13.         Expand the application heap
  14.         Initialize the toolbox
  15.         Initialize the random number generator.
  16.         Bring the program to the front.  Give time to other processes to let
  17.             them catch up.
  18.         Perform the test.
  19.     */
  20.  
  21.     MaxApplZone();
  22.     InitToolBox();
  23.     GetDateTime( &qd.randSeed );
  24.     FlushEvents( everyEvent, NO_STOP_MASK );
  25.     for ( i = 0; i < 6; i++ )
  26.         WaitNextEvent( everyEvent, &theEvent, 6, NIL_PTR );
  27.     /*
  28.         If you think the program is too malicious, uncomment the next line
  29.             of code to provide a dialog that warns the user to save files.
  30.  
  31.     status = DoWarningDialog();
  32.     */
  33.  
  34.     if ( noErr == status )
  35.         DoTest();
  36.     }
  37.     
  38.  
  39. void InitToolBox()
  40.     {
  41.     InitGraf( &qd.thePort );
  42.     InitFonts();
  43.     InitWindows();
  44.     InitMenus();
  45.     TEInit();
  46.     InitDialogs( NIL_PTR );
  47.     InitCursor();
  48.     }
  49.  
  50.  
  51. void CenterAsAlert(
  52.     DialogPtr            theDialog )
  53.     {
  54.     Point                dlogTopLeft;
  55.     
  56.     /*
  57.         Center as an Alert the window of a dialog.
  58.     */
  59.  
  60.     dlogTopLeft.h = ( ( screenBits.bounds.right - screenBits.bounds.left ) -
  61.         ( ( *theDialog ).portRect.right - ( *theDialog ).portRect.left ) ) / 2;
  62.     dlogTopLeft.v = ( ( screenBits.bounds.bottom - screenBits.bounds.top ) -
  63.         ( ( *theDialog ).portRect.bottom - ( *theDialog ).portRect.top ) ) / 3;
  64.     MoveWindow( theDialog, dlogTopLeft.h, dlogTopLeft.v, LEAVE_WHERE_IT_IS );
  65.     }
  66.  
  67.  
  68.  
  69.